<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .yin{
            display: none;
        }
        .content{
            width:600px;
            height: 400px;
            border:1px solid #000;
            margin-top:30px;
        }
    </style>
</head>
<body>
    <div>
        <span>公告</span>
        <span>规则</span>
        <span>论坛</span>
        <span>安全</span>
        <span>公益</span>
    </div>
    <div class="content">
        <ul>
            <li>这是公告的内容</li>
        </ul>
        <ul class="yin">
            <li>这是规则的内容</li>
        </ul>
        <ul class="yin">
            <li>这是论坛的内容</li>
        </ul>
        <ul class="yin">
            <li>这是安全的内容</li>
        </ul>
        <ul class="yin">
            <li>这是公益的内容</li>
        </ul>
    </div>
    <script>
        var spans=document.querySelectorAll("span");//集合
        var uls=document.querySelectorAll("ul");//集合
        for(let i=0;i<spans.length;i++){
            spans[i].onclick=function(){
                
                //利用循环给所有的span去掉下边框,去掉下面框中的内容
                for(var j=0;j<spans.length;j++){
                    spans[j].style.borderBottom="0px";
                    uls[j].style.display="none";
                }

               
                spans[i].style.borderBottom="1px solid orange";
                uls[i].style.display="block";
            };
        }
    </script>
</body>
</html>